Repository navigation
Conversation
The Windows installer is changed to allow several OpenModelica versions side by side (OpenModelica/OpenModelica#5809, OpenModelica/OpenModelicaSetup#96). OPENMODELICAHOME then points to the default one and each version sets OPENMODELICAHOME_<version>, with the characters of the version that are not letters or digits replaced by underscores (OPENMODELICAHOME_1_27_0). OMCSessionLocal and ModelicaSystemOMC get a version argument and look for OpenModelica in this order: 1. the omhome argument 2. the version argument: OPENMODELICAHOME_<version>, or the newest installed version that starts with it ("1.27" for the newest 1.27.x) 3. OPENMODELICAHOME 4. the newest OPENMODELICAHOME_<version> 5. omc on the PATH Without OPENMODELICAHOME_<version> variables nothing changes. With them, an OPENMODELICAHOME without an omc executable (left behind by an uninstalled version) is skipped. A version that is not installed raises OMSessionException with the list of the installed ones. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This was referenced Nov 17, 2026
shutil.which only finds a file with an executable extension on Windows, so the test that puts an empty omc on the PATH failed there. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
adeas31
approved these changes
Nov 18, 2026
| Raises: | ||
| OMSessionException: If OpenModelica cannot be located. | ||
| """ | ||
| if environ is None: |
Member
There was a problem hiding this comment.
This can go after omhome block as that returns if omhome is not None.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Client part of OpenModelica/OpenModelica#5809 (several OpenModelica versions installed side by side on Windows).
With OpenModelica/OpenModelicaSetup#96 the Windows installer keeps
OPENMODELICAHOMEfor the version selected as the default one and setsOPENMODELICAHOME_<version>for each installed version, with every character of the version that is not a letter or a digit replaced by an underscore, e.g.OPENMODELICAHOME_1_27_0orOPENMODELICAHOME_1_28_0_dev_1962_g6e348e217c.What changes
OMCSessionLocalandModelicaSystemOMCget aversionargument:OpenModelica is looked for in this order:
omhomeargumentversionargumentOPENMODELICAHOMEOPENMODELICAHOME_<version>omcon thePATHOMSessionExceptionwith the list of the installed ones.major.minor.patcha pre-release build (1.28.0-dev-…) is older than the release, which is older than a build after it (1.27.0-5-g…)."1.2"does not match1.27.0: the given version has to be followed by the end of the name or by_.omc_home_versions()lists the installations found in the environment, newest first.Compatibility
Without
OPENMODELICAHOME_<version>variables (Linux, macOS, the current Windows installer) nothing changes:OPENMODELICAHOMEis used as it is, thenomcon thePATH. With them, anOPENMODELICAHOMEthat has no omc executable (left behind by an uninstalled version) is skipped.Testing
tests/test_omc_home.py: 15 tests of the lookup with a fake environment and directories with an emptybin/omc; no omc is started.OPENMODELICAHOME_1_99_0=/usrandversion="1.99"(OMCSessionLocalandModelicaSystemOMC), with no version, and with a version that is not installed.tests/test_OMSessionCmd.pyandtests/test_ZMQ.pypass; flake8 and codespell are clean, mypy and pylint report nothing new.🤖 Generated with Claude Code